package gpl.androidcommons.scotlandyard.ui;

import gpl.scotlandyard.beans.basics.Node;
import android.graphics.Color;

public enum SYColors {
  ORANGE(Color.rgb(255, 120, 80)), RED(Color.rgb(240, 40, 40)), GREEN(Color.rgb(10, 170, 10)), YELLOW(Color.rgb(230, 205, 0)), BLACK(Color
      .rgb(50, 50, 50)), TRANSPARENT(Color.TRANSPARENT), WHITE(Color.WHITE);

  private final int rgbColor;

  private SYColors(int rgbColor) {
    this.rgbColor = rgbColor;
  }

  public int getRgbColor() {
    return rgbColor;
  }

  private static final int CAPACITY_LOW = 3;
  private static final int CAPACITY_MEDIUM = 5;
  private static final int CAPACITY_HIGH = 8;

  public static SYColors color4dNode(Node node) {
    int capacity = node.getLinks().size();
    if (capacity <= CAPACITY_LOW) {
      return SYColors.TRANSPARENT;
    }
    if (capacity <= CAPACITY_MEDIUM) {
      return SYColors.GREEN;
    }
    if (capacity <= CAPACITY_HIGH) {
      return SYColors.YELLOW;
    }
    return SYColors.RED;
  }
}
